home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-21 | 5.8 KB | 221 lines | [TEXT/MPS ] |
- BLANKS ON
- STRING ASIS
-
- PRINT OFF
- INCLUDE 'ToolEqu.a'
- INCLUDE 'Traps.a'
- INCLUDE 'SysEqu.a'
- INCLUDE 'QuickEqu.a'
- PRINT ON
-
- GRAF0 PROC EXPORT
- IMPORT CSEARCH
-
- LinkSize EQU -60
- xxxxxxxx equ -38
- SavBkCol EQU -32
- SavFgCol EQU -26
- theColor equ -20
- drawLength equ -16
- drawAddr equ -12
-
- testLength equ -8
- startAddr EQU -4
-
- ;
- dc.l 0 ; grafproc 1 of 13
- dc.l 0 ; grafproc 2 of 13
- dc.l 0 ; grafproc 3 of 13
- dc.l 0 ; grafproc 4 of 13
- dc.l 0 ; grafproc 5 of 13
- dc.l 0 ; grafproc 6 of 13
- dc.l 0 ; grafproc 7 of 13
- dc.l 0 ; grafproc 8 of 13
- dc.l 0 ; grafproc 9 of 13
- dc.l 0 ; grafproc 10 of 13
- dc.l 0 ; grafproc 11 of 13
- dc.l 0 ; grafproc 12 of 13
- dc.l 0 ; grafproc 13 of 13
- origAddr dc.l 0 ; stored address of original StdText procedure
- ;
- ; PROCEDURE StdText(byteCount: short, +20
- ; bytePtr: Ptr, +16
- ; xxx: Point, +12
- ; yyy: Point) +8
- ;
- ;
- DP1
- LINK A6,#LinkSize ; set up a stack frame to address parameters
- MOVEM.L D3-D7/A1-A4,-(SP) ; save work registers
-
- clr.l d3
- move.w 20(a6),d3 ; get string length
- move.l 16(a6),a3 ; get pointer
-
- clr.l drawAddr(a6) ; clear the early draw addr
- @2
- clr.l startAddr(a6) ; clear the start address
- clr.l testLength(a6) ; clear the length
- @4
- clr.l d4 ;
- move.b (a3),d4 ;
- lea.l table1,a0 ;
- add.l d4,a0
- cmpi.b #'y',(a0) ; is this a string character ?
- bne.s @20 ; if not go to @20
-
- tst.l startAddr(a6) ; do we a start addr ?
- bne.s @10 ; yes
- move.l a3,startAddr(a6)
- @10
- addq.l #1,testLength(a6) ; add 1 to length
-
- addq.l #1,a3 ; pt to nex byte
- subq.l #1,d3 ; sub one
- bne.s @4 ; loop if more
- bra.s @30 ; final check
-
- @20
- tst.l drawAddr(a6) ; do we a start addr ?
- bne.s @22 ; yes
- move.l a3,drawAddr(a6)
- @22
-
- tst.l testLength(a6) ; did we get any ?
- beq.s @25 ; no so skip
-
- bsr.s CallSearch ; call the searcher
- move.l a3,drawAddr(a6) ; set the breaking byte addr
- @25
- addq.l #1,a3 ; pt to nex byte
- subq.l #1,d3 ; sub one
- bne.s @4 ; loop if more
- @30
- tst.l testLength(a6) ; did we get any ?
- beq.s @35 ; no so skip
-
- bsr.s CallSearch ; call the searcher
- clr.l drawAddr(a6) ; clear the breaking byte addr
- @35
- bsr DrawFinal ; see if any more left
-
- MOVEM.L (SP)+,D3-D7/A1-A4 ; restore work registers
- UNLK A6 ; unlink stack frame
- MOVE.L (SP)+,A0 ; get return address
- ADD #14,SP ; strip parameters
- JMP (A0) ; return to caller
-
- DrawSome
- move.w d0,-(sp) ; push byteCount
- move.l a0,-(sp) ; push bytePtr
- move.l 12(a6),-(sp) ; push xxx
- move.l 8(a6),-(sp) ; push yyy
- move.l origAddr,a0 ; get orig addr
- jsr (a0) ; call the original guy
- rts
-
- CallSearch
- clr.l -(sp) ; result
- move.l startAddr(a6),-(sp) ; the string addr
- move.l testLength(a6),-(sp) ; the string length
- pea.l theColor(a6) ; pt to the color
- jsr CSEARCH ; search for the string
-
- move.l (sp)+,d4 ; is this a hit
- beq.s @600 ; no
- ;
- ; ok, we got a hit, so we do a two stage draw, first default, then in color
- ;
- tst.l drawAddr(a6) ; is there any previous to draw ?
- beq.s @500 ; no
-
- move.l startAddr(a6),d0
- sub.l drawAddr(a6),d0 ;
- move.l drawAddr(a6),a0 ;
- bsr.s DrawSome
- @500
- PEA SavFgCol(A6) ; push a pointer to save area
- _GetForeColor ; get the current color
- PEA SavBkCol(A6) ;
- _GetBackColor ;
-
- PEA theColor(a6) ; point to color
- _RGBForeColor ;
- move.l startAddr(a6),a0 ; get pointer
- move.l testLength(a6),d0 ; get length
- bsr DrawSome
-
- PEA savBkCol(A6) ;
- _RGBBackColor ;
- PEA savFgCol(A6) ;
- _RGBForeColor ;
-
- clr.l drawAddr(a6)
- bra.s @700
- @600
- ; here we do a one stage draw
- tst.l drawAddr(a6) ;
- beq.s @650 ; no, no first part to draw
-
- move.l startAddr(a6),d0 ;
- sub.l drawAddr(a6),d0 ;
- move.l drawAddr(a6),a0 ;
- bsr.s DrawSome ;
- @650
- move.l startAddr(a6),a0 ;
- move.l testLength(a6),d0 ;
- bsr.s DrawSome ;
- @700
- clr.l drawAddr(a6) ; clear the early draw addr
- clr.l startAddr(a6) ; clear the start address
- clr.l testLength(a6) ; clear the length
- rts
-
- DrawFinal
- tst.l drawAddr(a6) ; is there any previous to draw ?
- beq.s @800 ; no
-
- move.l a3,d0 ;
- sub.l drawAddr(a6),d0 ;
- move.l drawAddr(a6),a0 ;
- bsr.s DrawSome
- @800
- rts
-
-
-
- mockup1 dc.w $F2D7,$0856,$84EC ; magenta
- dc.w $0000,$0000,$D400 ; blue
- dc.w $0000,$8000,$11B0 ; green
- dc.w $0241,$AB54,$EAFF ; cyan
- dc.w $DD6B,$08C2,$06A2 ; red
-
- ; 0 black $0000 $0000 $0000
- ; 1 yellow $FC00 $F37D $052F
- ; 2 magenta $F2D7 $0856 $84EC
- ; 3 red $DD6B $08C2 $06A2
- ; 4 cyan $0241 $AB54 $EAFF
- ; 5 green $0000 $8000 $11B0
- ; 6 blue $0000 $0000 $D400
- ; 7 white $FFFF $FFFF $FFFF
-
- string asis
- table1 dc.b 'nnnnnnnnnnnnnnnn' ; 00-0f ................
- dc.b 'nnnnnnnnnnnnnnnn' ; 10-1f ................
- dc.b 'nnnynnnnnnnnnnnn' ; 20-2f ...#............
- dc.b 'yyyyyyyyyynnnnnn' ; 30-3f 0123456789......
- dc.b 'nyyyyyyyyyyyyyyy' ; 40-4f .ABCDEFGHIJKLMNO
- dc.b 'yyyyyyyyyyynnnny' ; 50-5f PQRSTUVWXYZ...._
- dc.b 'nyyyyyyyyyyyyyyy' ; 60-6f .abcdefghijklmno
- dc.b 'yyyyyyyyyyynnnnn' ; 70-7f pqrstuvwxyz.....
- dc.b 'nnnnnnnnnnnnnnnn' ; 80-8f ................
- dc.b 'nnnnnnnnnnnnnnnn' ; 90-9f ................
- dc.b 'nnnnnnnnnnnnnnnn' ; a0-af ................
- dc.b 'nnnnnnnnnnnnnnnn' ; b0-bf ................
- dc.b 'nnnnnnnnnnnnnnnn' ; c0-cf ................
- dc.b 'nnnnnnnnnnnnnnnn' ; d0-df ................
- dc.b 'nnnnnnnnnnnnnnnn' ; e0-ef ................
- dc.b 'nnnnnnnnnnnnnnnn' ; f0-ff ................
-
- endp
- end